home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / scripts / erase-rows.scm.z / erase-rows.scm
Encoding:
Text File  |  1999-07-21  |  1.1 KB  |  34 lines

  1. (define (script-fu-erase-rows img drawable orientation which)
  2.   (let* ((width (car (gimp-drawable-width drawable)))
  3.      (height (car (gimp-drawable-height drawable))))
  4.     (gimp-image-disable-undo img)
  5.     (letrec ((loop (lambda (i max)
  6.              (if (< i max)
  7.              (begin
  8.                (if (eq? orientation 'rows)
  9.                    (gimp-rect-select img 0 i width 1 REPLACE FALSE 0)
  10.                    (gimp-rect-select img i 0 1 height REPLACE FALSE 0))
  11.                (gimp-edit-fill img drawable)
  12.                (loop (+ i 2) max))))))
  13.       (loop (if (eq? which 'even)
  14.         0
  15.         1)
  16.         (if (eq? orientation 'rows)
  17.         height
  18.         width)))
  19.     (gimp-selection-none img)
  20.     (gimp-image-enable-undo img)
  21.     (gimp-displays-flush)))
  22.  
  23. (script-fu-register "script-fu-erase-rows"
  24.             "<Image>/Script-Fu/Alchemy/Erase every other row"
  25.             "Erase every other row/column with the background color"
  26.             "Federico Mena Quintero"
  27.             "Federico Mena Quintero"
  28.             "June 1997"
  29.             "RGB*, GRAY*, INDEXED*"
  30.             SF-IMAGE "Image" 0
  31.             SF-DRAWABLE "Drawable" 0
  32.             SF-VALUE "Rows/cols" "'rows"
  33.             SF-VALUE "Even/odd" "'even")
  34.